package com.gotloop.controllers;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

/**
 * Used to retrieve and publish RSS Feeds for Loops.
 * @author jibhaine
 *
 */
@Controller
@RequestMapping(value = { "/feed" })
public class FeedController {

	/**
	 * Redirects to the feedchoice page.
	 * @return the feeds view
	 */
	@RequestMapping(value = { "/", "/rss", "/atom" })
	public String feedsPage() {
		return "feeds";
	}
	
	/**
	 * Rss feed for the last loops.
	 * @return rss view with loops
	 */
    @RequestMapping(value = { "/rss/loops" })
    public ModelAndView rssLoops() {
    	return new ModelAndView("rssView");
    }

	/**
	 * Rss feed for the last comments.
	 * @return rss view with comments
	 */
    @RequestMapping(value = { "/rss/comments" })
    public ModelAndView rssComments() {
    	return new ModelAndView("rssView");
    }

	/**
	 * Atom feed for the last loops.
	 * @return atom view with loops
	 */
    @RequestMapping(value = { "/atom/loops" })
    public ModelAndView atomLoops() {
    	return new ModelAndView("atomView");
    }

	/**
	 * Atom feed for the last comments.
	 * @return atom view with comments
	 */
    @RequestMapping(value = { "/atom/comments" })
    public ModelAndView atomComments() {
    	return new ModelAndView("atomView");
    }
}
